package com.inspur.s57.datacatalog.utils;

import com.inspur.s57.datacatalog.entity.CataLog;
import com.inspur.s57.datacatalog.entity.DataAttribute;
import com.inspur.s57.datacatalog.vo.Select2VO;

import java.util.ArrayList;
import java.util.List;

public class Select2Util {

    public static List<Select2VO> dataAttributes2Select2VO(List<DataAttribute> attributes){
        List<Select2VO> select2VOS=new ArrayList<>();
        attributes.forEach(attribute -> {
            Select2VO select2VO=new Select2VO();
            select2VO.setId(attribute.getId());
            select2VO.setText(attribute.getName());
            select2VOS.add(select2VO);
        });
        return select2VOS;
    }

    public static List<Select2VO> CataLog2Select2VO(List<CataLog> cataLogs){
        List<Select2VO> select2VOS=new ArrayList<>();
        cataLogs.forEach(attribute -> {
            Select2VO select2VO=new Select2VO();
            select2VO.setId(attribute.getId());
            select2VO.setText(attribute.getClassName());
            select2VOS.add(select2VO);
        });
        return select2VOS;
    }
}
